//
//  NHTViewController.m
//  NHT_Function
//
//  Created by nhtemail@163.com on 06/06/2024.
//  Copyright (c) 2024 nhtemail@163.com. All rights reserved.
//

#import "NHTViewController.h"
#import <NHTFunction.h>

@interface NHTViewController ()

@end

@implementation NHTViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *marker = [[UIButton alloc] initWithFrame:CGRectMake(10, 100, 100, 50)];
    marker.backgroundColor = UIColor.redColor;
    [self.view addSubview:marker];
    [marker addTarget:self action:@selector(startVideo) forControlEvents:UIControlEventTouchUpInside];
    [self.view  bringSubviewToFront:marker];
    
    
    UIButton *stop = [[UIButton alloc] initWithFrame:CGRectMake(10, 210, 100, 50)];
    stop.backgroundColor = UIColor.redColor;
    [self.view addSubview:stop];
    [stop addTarget:self action:@selector(stop) forControlEvents:UIControlEventTouchUpInside];
    [self.view  bringSubviewToFront:stop];
}

-(void)startVideo{
    [[NHTFunction share] setDebugMode];
//    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:strPhone]];

//    [[NHTFunction shareFunction] callPhone:@"1234"];
    
//    [NHTFunction share].voice = 0.3f;
//    [[NHTFunction share] setDebugMode];
//    [[NHTFunction share] startChangeTextToSpeech:@"哈哈asdqwesdds" repeatPlay:YES];
//    [NHTFunction shareFunction].showRefuseAlert = false;
//    [NHTFunction shareFunction].refuseAlertShowCancel = false;
//    [[NHTFunction share] checkIsHavePower_Microphone:^(NSInteger status) {
//        NSLog(@"-------:%ld",(long)status);
//    }];
//
//    @"https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3"
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"fire_alarm" ofType:@"wav"];
//    [[NHTFunction share] startPlayLocalAudio:@"fire_alarm" type:@"wav" repeatPlay:false];
    [[NHTFunction share] startPlayLocalAudio:filePath repeatPlay:true];
//    [[NHTFunction share] startPlayUrlAudio:@"https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3" repeatPlay:true];
}
-(void)stop{
    [[NHTFunction share] stopPlayAudio];
//    [[NHTFunction shareFunction] stopChangeTextToSpeech];
}

@end
